/**
 * 
 */
package com.google.code.sip.ucenter.dao.mongo;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import com.google.code.sip.core.dao.mongo.GenericMongoDao;
import com.google.code.sip.ucenter.dao.CreditRuleLogDao;
import com.google.code.sip.ucenter.model.CreditRule;
import com.google.code.sip.ucenter.model.CreditRuleLog;
import com.google.code.sip.ucenter.model.User;

/**
 * @author Liuye
 * 
 */

public class CreditRuleLogDaoImpl extends
		GenericMongoDao<CreditRuleLog, String> implements CreditRuleLogDao {
	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.google.code.sip.ucenter.dao.mongo.CreditRuleLogDao#getByUserAndRule(com
	 * .google.code.ucenter.model.User,
	 * com.google.code.sip.ucenter.model.CreditRule)
	 */
	public CreditRuleLog getByUserAndRule(User user, CreditRule creditRule) {
		Map<String, Object> filters = new LinkedHashMap<String, Object>();
		filters.put("user", user);
		filters.put("creditRule", creditRule);
		return getByProperties(filters);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.google.code.sip.ucenter.dao.mongo.CreditRuleLogDao#findByUser(com.google
	 * .code.ucenter.model.User)
	 */
	public List<CreditRuleLog> findByUser(User user) {
		return findByProperty("user", user);
	}
}
